<?php

namespace App\Admin\Controllers;

use App\Services\PreDzlabQwenPackService;
use Slowlyo\OwlAdmin\Controllers\AdminController;

/**
 * 套餐记录
 *
 * @property PreDzlabQwenPackService $service
 */
class PreDzlabQwenPackController extends AdminController
{
	protected string $serviceName = PreDzlabQwenPackService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filter($this->baseFilter()->body([
				amis()->TextControl('username', '用户名')->placeholder('请输入用户名'),
			]))
			->filterTogglable()
			->headerToolbar([
				...$this->baseHeaderToolBar()
			])
			->bulkActions([])
			->columns([
				amis()->TableColumn('user.username', '用户名'),
				amis()->TableColumn('name', '套餐名称'),
				amis()->TableColumn('created_at', '购买时间')->sortable(),
				amis()->TableColumn('expire_at', '到期时间')->sortable(),
				amis()->TableColumn('uesd_num', '使用次数')->sortable(),
				amis()->TableColumn('surplus_num', '剩余次数')->sortable(),
			]);

		return $this->baseList($crud);
	}

}
